Flajolet-Martin (simplified):

  • Choose random hash function h:𝒰→[0,1]h: \mathcal{U} \rightarrow [0,1].
  • S=1S = 1
  • For i=1,…,ni=1,…,n:
    • S→min⁡(S,h(xi))S \rightarrow \min(S,h(x_i))
  • return: D~=1S−1\tilde{D} = \frac{1}{S}-1

Lemma:

DD distinct items in our stream,

𝔼[S]=1D+1\mathbb{E}[S] = \frac{1}{D+1}

proof:

⚠️ add to notes here later

Lemma:

Var[S]=𝔼[S2]−𝔼[S]2=2(D+1)(D+2)−1(D+1)2≤1(D+1)2\mathrm{Var}[S] = \mathbb{E}[S^2]-\mathbb{E}[S]^2 = \frac{2}{(D+1)(D+2)}-\frac{1}{(D+1)^2} \leq \frac{1}{(D+1)^2}

proof:

⚠️ add to notes here later #incomplete


References: